<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="stylesheet" type="text/css" href="${ctx}/static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="${ctx}/static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="${ctx}/lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="${ctx}/static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="${ctx}/static/h-ui.admin/css/style.css" />
<title>编辑 - 景区信息 </title>
<meta name="keywords" content="">
<meta name="description" content="">
</head>
<body>
<article class="page-container">
	<form class="form form-horizontal" id="form-admin-edit" enctype="multipart/form-data">
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>景区名称：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text" value="${scenic.name }" placeholder="" id="name" name="name" />	
			<input type="hidden" class="input-text" value="${scenic.id }" placeholder="" id="id" name="id"/>
		</div>
	</div>
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>经度：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text" value="${scenic.lng }" placeholder="" id="lng" name="lng"/>
		</div>
	</div>
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>纬度：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text" value="${scenic.lat }" placeholder="" id="lat" name="lat"/>
		</div>
	</div>
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3">介绍：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<textarea name=introduce cols="8" rows="8" class="textarea"  placeholder="1000个字符以内"  dragonfly="true" onKeyUp="$.Huitextarealength(this,1000)">${scenic.introduce }</textarea>
		</div>
	</div>
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>景区图片：</label>
		<span class="btn-upload col-xs-8 col-sm-9">
		<img src=""  class="radius"/> 
  		<a href="javascript:void();" class="btn btn-primary radius"><i class="iconfont">&#xf0020;</i> 浏览</a>
  		<input type="file" multiple name="file0" class="input-file"/>
		</span>
	</div>
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3">720全景封面：</label>
		<span class="btn-upload col-xs-8 col-sm-9">
		<input type="hidden" class="input-text" value="${scenic.allviewimg }" placeholder="" id="allviewimg" name="allviewimg"/>
		<img  src=""  class="radius"/> 
  		<a href="javascript:void();" class="btn btn-primary radius"><i class="iconfont">&#xf0020;</i> 浏览</a>
  		<input type="file" name="file1" id="file1" class="input-file" onchange="fileupload(this)" />
		</span>
	</div>
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3">全景地址：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text" value="${scenic.allviewurl }" placeholder="" id="allviewurl" name="allviewurl"/>
		</div>
	</div>
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3">语音包：</label>
		<span class="btn-upload col-xs-8 col-sm-9">
		<img src=""  class="radius"/> 
  		<a href="javascript:void();" class="btn btn-primary radius"><i class="iconfont">&#xf0020;</i> 浏览</a>
  		<input type="file" name="file2" class="input-file"/>
		</span>
	</div>
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3">电话：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text" value="${scenic.phone }" placeholder="" id="phone" name="phone"/>
		</div>
	</div>
	<div class="row cl">
		<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>地址：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text" placeholder="@" name="address" id="address" value="${scenic.address }"/>
		</div>
	</div>	
	<div class="row cl">
		<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
			<input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;"/>
		</div>
	</div>
	</form>
</article>


<!--_footer 作为公共模版分离出去--> 
<script type="text/javascript" src="${ctx}/lib/jquery/1.9.1/jquery.js"></script>
<script type="text/javascript" src="${ctx}/lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="${ctx}/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="${ctx}/static/h-ui/js/H-ui.min.js"></script> 
<script type="text/javascript" src="${ctx}/static/h-ui.admin/js/H-ui.admin.js"></script>
<!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="${ctx}/lib/jquery.validation/1.14.0/jquery.validate.js"></script> 
<script type="text/javascript" src="${ctx}/lib/jquery.validation/1.14.0/validate-methods.js"></script> 
<script type="text/javascript" src="${ctx}/lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript" src="${ctx}/static/h-ui/js/H-ui.js"></script>

<script type="text/javascript" src="${ctx}/lib/ajaxfileupload.js"></script> 

<script type="text/javascript">
$(function(){
  	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});  
	
	$("#form-admin-edit").validate({
		rules:{
			name:{
				required:true,
			},
			introduce:{
				required:true,
			},
			sceneryimg:{
				required:true,
			},
			voice:{
				required:true,
			},
			phone:{
				required:true,
				isPhone:true,
			},
			address:{
				required:true,
			},
		},
		onkeyup:false,
		focusCleanup:true,
		success:"valid",
		submitHandler:function(form){
			$.ajax({
				type: 'post',
				url: "scenicspotInfoSave" ,
				data:$(form).serialize(),
				async: false,
				dataType: "json", 
				success: function(data){
					parent.layer.msg(data.desc+"!<script>setTimeout('window.location.reload();',1100);<\/script>", {icon: 6,time:1150});
					var index = parent.layer.getFrameIndex(window.name);
					parent.layer.close(index);
					
				},
                error: function(XmlHttpRequest, textStatus, errorThrown){
					layer.msg('error!',{icon:1,time:1000});
					var index = parent.layer.getFrameIndex(window.name);
					parent.layer.close(index);
				}
			});
			
		}
	});
	
	

	
});

function fileupload(obj){
	alert(obj.value);

$.ajaxFileUpload({
	url : '${ctx}/upload',
	secureuri : false,
	fileElementId : 'file1',
	dataType : 'json',
	data : {username : obj.value},
	success : function(data, status) {
		alert(data.status);
	},
	error : function(data, status, e) {
		alert('上传出错');
	}
});

}

</script> 

</body>
</html>